//
//  DataHelper.m
//  MelonGOLF
//
//  Created by MacMini on 9/15/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "DataHelper.h"
#import "DataUtils.h"

@implementation DataHelper


/*+ (HoleData*)loadDataAt: (NSString*)HoleName
{
	
	
	
	
	//size
	NSString* strSize = [data objectForKey:@"Size"];
	holeData.size = CGSizeFromString(strSize);
	
	//background filename
	NSString* str = [data objectForKey:@"BackgroundFileName"];
	holeData.backgroundFilename = str;
	
	//start position
	NSString* strStartPos = [data objectForKey:@"StartPosition"];
	CGPoint startPos = CGPointFromString(strStartPos);
	holeData.startPosition = startPos;
	
	//hole
	NSNumber *sNumber = [data objectForKey:@"HoleBottomIndex"];
	int holeBottomIndx = [sNumber intValue];
	holeData.holeBottomIndex = holeBottomIndx;
	
	//dead bottom
	NSArray* deadArray = [data objectForKey:@"DeadBottomIndex"];
	holeData.deadBottomIndex = deadArray;
	
	//
	NSArray* pointArray = [data objectForKey:@"PointList"];
	holeData.pointList = pointArray;
	
	
	return [holeData autorelease];
}*/

+(int )countData: (NSString*)HoleName
{
	DataUtils* dataUtils = [DataUtils shareInstanse];
		
	NSArray* data = (NSArray*)[dataUtils objectForKey:HoleName];
	
	
	
	return [data count];
	
	
}

+(dataBridge *)loadDataBridgeAt: (NSString*)_map:(int )vitri
{
	DataUtils* dataUtils = [DataUtils shareInstanse];
	NSArray* data = (NSArray*)[dataUtils objectForKey:_map];
	dataBridge *_dataBR	=[[dataBridge alloc] init];
	
	NSDictionary *_readDataBR=(NSDictionary *)[data objectAtIndex:vitri];
	
	
	
	NSString* strname = [_readDataBR objectForKey:@"name"];
	NSLog(@"%@",strname);
	
	_dataBR._strName=[NSString stringWithFormat:@"%@",strname];
	
	NSString* strSize = [_readDataBR objectForKey:@"pos"];
	CGPoint temp= CGPointFromString(strSize);
	_dataBR._cgPosition =temp;
	
	
	NSNumber *sNumber_W=[_readDataBR objectForKey:@"width"]; 
	float numberW = [sNumber_W floatValue];
	_dataBR._width=numberW;
	
	
	NSNumber *sNumber_H=[_readDataBR objectForKey:@"height"]; 
	float numberH = [sNumber_H floatValue];
	_dataBR._height=numberH;
	
	
	return [_dataBR autorelease];;
	
	
}



@end
